<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>头像上传成功</title>
</head>
<body>
<h1>个人中心</h1>
<?php
$oldName = $_FILES['file']['name'];
$arr = explode('.',$oldName);
$newName = md5($oldName.time()).'.'.$arr[count($arr)-1];
move_uploaded_file($_FILES['file']['tmp_name'],'img/'.$newName);
$img_url = 'public/img/'.$newName;

?>
你的头像是:
<img src="<?php echo $img_url; ?>" >
</body>
</html>